package com.module.lemlin.http

import okhttp3.MediaType
import okhttp3.RequestBody
import okio.*

class ProgressRequestBody(
    private val mRequestBody: RequestBody,
    private val mProgressListener: ProgressListener?= null
) : RequestBody() {

    override fun contentType(): MediaType? {
        return mRequestBody.contentType()
    }

    override fun contentLength(): Long {
        return mRequestBody.contentLength()
    }

    override fun writeTo(sink: BufferedSink) {
        val bufferedSink: BufferedSink = object : ForwardingSink(sink) {
            override fun write(source: Buffer, byteCount: Long) {
                super.write(source, byteCount)

            }
        }.buffer()
        mRequestBody.writeTo(bufferedSink)
        bufferedSink.flush()
    }
}